package com.wch.spring.utils;

import com.alibaba.druid.pool.DruidDataSource;

/**
 * druid工具类  饿汉式单例设计模式
 */
public class DruidUtils {
    private DruidUtils(){
    }
    private static DruidDataSource druidDataSource = new DruidDataSource();


    static {
        druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        druidDataSource.setUrl("jdbc:mysql://localhost:3306/bank?userSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf-8");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("root");
    }

    public static DruidDataSource getInstance() {
        return druidDataSource;
    }
}
